from soj.tests.common import Test
from pathlib import Path
from soj.builtin.compare.token.token import TokenCompare
from soj.builtin.compare.common import ResultCode

TEST=Path(__file__).parent.resolve()
TEST_A=TEST/"a.txt"
TEST_B=TEST/"b.txt"
TEST_C=TEST/"c.txt"
TEST_D=TEST/"d.txt"
TEST_E=TEST/"e.txt"

if __name__=="__main__":
    t=Test()

    fcb=TokenCompare(TEST_A,TEST_B)
    fcc=TokenCompare(TEST_A,TEST_C)
    fcd=TokenCompare(TEST_A,TEST_D)
    fce=TokenCompare(TEST_A,TEST_E)

    rb=fcb.compare()
    rc=fcc.compare()
    rd=fcd.compare()
    re=fce.compare()

    t.ensure(rb["result_code"]==ResultCode.UNACCEPTABLE)
    print("A<>B ",rb)
    t.ensure(rc['result_code']==ResultCode.UNACCEPTABLE)
    print("A<>C ",rc)
    t.ensure(rd['result_code']==ResultCode.FAILED)
    print("A<>D ",rd)
    t.ensure(re['result_code']==ResultCode.ACCEPTABLE)
    print("A<>E ",re)
    t.print_report()